<template>
  <div>
    <table class="table table-bordered vertical-align-middle text-center table-sm">
      <colgroup>
        <col width="20%" />
        <col width="30%" />
        <col width="25%" />
        <col width="25%" />
      </colgroup>
      <tbody>
        <tr>
          <td>客户名称</td>
          <td>{{ formData.customer_name }}</td>
          <td>证件号</td>
          <td>{{ customerNo }}</td>
        </tr>
        <!-- <tr>
          <td>贷款开始时间</td>
          <td>{{ dateFormat(formData.load_date, 'yyyy-MM-dd') }}</td>
          <td>贷款结束时间</td>
          <td>{{ dateFormat(formData.load_end_date, 'yyyy-MM-dd') }}</td>
        </tr> -->
        <tr>
          <td>展期金额</td>
          <td>{{ formData.exh_funds || '-' }} 万元</td>
          <td>展期时间</td>
          <td>{{ dateFormat(formData.exh_end_date, 'yyyy-MM-dd') }}</td>
        </tr>
        <tr>
          <td>展期附件</td>
          <td colspan="3">
            <ul class="list-unstyled">
              <li v-for="(attach, index) in exhAttachment" :key="index">
                <attach-item :attach-data="attach"></attach-item>
              </li>
            </ul>
          </td>
        </tr>
      </tbody>
    </table>
  </div>
</template>

<script>
import { arrayFromString, dateFormat } from '@vimi/utils-tool'
import { attachAdapter } from '@/bank/components/attach/index'
import AttachItem from '@/bank/components/attach/Item'
export default {
  components: {
    AttachItem,
  },
  props: {
    formData: {
      type: Object,
      default: () => ({}),
    },
  },
  data() {
    return {
      dateFormat,
    }
  },
  computed: {
    customerNo() {
      return +(this.formData.customer_type || '') === 1
        ? this.formData.register_no
        : this.formData.lender_idcard
    },
    exhAttachment() {
      return arrayFromString(this.formData.exh_attachment).map(it =>
        attachAdapter({ attachment: it })
      )
    },
  },
  watch: {},
  created() {},
  mounted() {},
  methods: {},
}
</script>

<style lang="scss" scoped></style>
